
exports.__esModule = true;
exports.default = void 0;

const _utils = require('../../utils');

const _utils2 = require('../utils');

const _createNamespace = (0, _utils.createNamespace)('calendar-header');
const createComponent = _createNamespace[0];

const _default = createComponent({
  props: {
    title: String,
    subtitle: String,
    showTitle: Boolean,
    showSubtitle: Boolean,
  },
  methods: {
    genTitle: function genTitle() {
      const h = this.$createElement;

      if (this.showTitle) {
        const title = this.slots('title') || this.title || (0, _utils2.t)('title');
        return h('div', {
          class: (0, _utils2.bem)('header-title'),
        }, [title]);
      }
    },
    genSubtitle: function genSubtitle() {
      const h = this.$createElement;

      if (this.showSubtitle) {
        return h('div', {
          class: (0, _utils2.bem)('header-subtitle'),
        }, [this.subtitle]);
      }
    },
    genWeekDays: function genWeekDays() {
      const h = this.$createElement;
      const weekdays = (0, _utils2.t)('weekdays');
      return h('div', {
        class: (0, _utils2.bem)('weekdays'),
      }, [weekdays.map((item) => h('span', {
        class: (0, _utils2.bem)('weekday'),
      }, [item]))]);
    },
  },
  render: function render() {
    const h = arguments[0];
    return h('div', {
      class: (0, _utils2.bem)('header'),
    }, [this.genTitle(), this.genSubtitle(), this.genWeekDays()]);
  },
});

exports.default = _default;
